package com.icexxx.icemock.mock;

import java.util.List;

import cn.hutool.core.convert.Convert;
import cn.hutool.core.util.RandomUtil;

public class PhoneMock implements IceMock {

	@Override
	public String mock(Integer minVal, Integer maxVal, Integer minWidth, Integer maxWidth, String enums,
			String key) {
		int frequency = RandomUtil.randomInt(100);
		int[] headArray = { 166, 198, 199 };
		String headNum = null;
		if (frequency < 10) {
			List<Integer> asList = Convert.toList(Integer.class, headArray);
			int headNumber = RandomUtil.randomEle(asList);
			headNum = String.valueOf(headNumber);
		} else {
			int num = RandomUtil.randomInt(5);
			int onesDigit = RandomUtil.randomInt(10);
			if (num < 3) {
				num += 13;
			} else {
				num += 14;
			}
			headNum = String.valueOf(num) + onesDigit;
		}
		String randomNumbers = RandomUtil.randomNumbers(8);
		return headNum + randomNumbers;
	}

}
